# Contributor: TBK <alpine@jjtc.eu>
# Maintainer: TBK <alpine@jjtc.eu>
pkgname=debconf
pkgver=1.5.74
pkgrel=0
pkgdesc="A configuration management system for Debian packages."
url="https://packages.debian.org/debconf"
arch="noarch"
license="BSD-2-Clause"
options="!check" # Test suite is broken. CopyDBTestSetup is missing new method
depends="perl"
makedepends="coreutils diffutils findutils po4a"
checkdepends="perl-freezethaw perl-ldap perl-test-unit"
subpackages="$pkgname-doc $pkgname-lang $pkgname-utils $pkgname-bash-completion"
source="https://deb.debian.org/debian/pool/main/d/debconf/debconf_$pkgver.tar.xz
	fix-makefile_destdir.patch
	"
builddir="$srcdir/work"

build() {
	make
}

check() {
	./test_debconf.pl --all
}

package() {
	make PREFIX=/usr DESTDIR="$pkgdir" install-i18n install-doc install-rest

	install -Dm0644 "$builddir"/bash_completion \
		"$pkgdir"/usr/share/bash-completion/completions/debconf
	cd "$pkgdir"/usr/share/bash-completion/completions
	ln -s debconf debconf-show
}

utils() {
	depends="$pkgname"
	pkgdesc="Small utilities for debconf developers."

	cd "$builddir"
	make PREFIX=/usr DESTDIR="$subpkgdir" install-utils
}

sha512sums="421577c9fb0dae1c851c6676e7b0b3e59e5800d1ab01a9817e4506ee2f7cb812065e1a64b194b1192023951f1f0cabf0359e4dae4320b9cf0705865085cdc5cd  debconf_1.5.74.tar.xz
17094b77ccf7922daf28dbf2eba84a322ac8ca265a41403b963d97ea4c1c16d8e530bcb3414f9b1bca88cbc5f726d2401376ee20674547d7b528c52d8f496f8c  fix-makefile_destdir.patch"
